<?php

// ##############################################################################||
// #                                                                 
// #   MySmartBB Version 1.7.0	                                      
// #   http://www.MySmartBB.com                                      
// #   Copyright (c) 2008 by MySmartBB team                           
// #   license http://opensource.org/licenses/gpl-license.php GNU Public License
// #                                                             
// #   filename : postpreview.php                                          
// #  TO preview the text befor submit it             
// #                                                                  
// ##############################################################################||

        // **********************************
        // الرجاء عدم إزالة وصف الحقوق
        // Please don't remove the copyright note
        // MagicToolBox hack 2.0 by Alawi Hussain Ba3qeel © http://www.rayaheen.net
        // ( free software )
        // **********************************

    include('common.php');
	    $SF->html_title_page('معاينة مشاركة - (Powered By MySmartBB Universal)');
        if (!isset($preview_flag) or $preview_flag != "1") {
?>
        <h2 align="center">تحميل صفحة المعاينة ، الرجاء الانتظار ...</p>
        <script language="javascript">
                window.focus();
        </script>
        <form name="pform" action="postpreview.php" method="post" style="display:none">
        <textarea name="text"></textarea><input type="hidden" name="preview_flag" value="1">
        </form>
        <script language="javascript">
                pform.text.value = opener.document.topic.S1.value;
                pform.submit();
        </script>
<?
}else{
$text = str_replace('\"','"', $text);
$text = str_replace('>', '&gt;', $text);
$text = str_replace('<', '&lt;', $text);
 $smile_query = $DB->sql_query("SELECT * FROM " . $db_prefix . "smiles WHERE smile_type='0'");
 while ($smile_row = $DB->sql_fetch_array($smile_query)){
        $text = str_replace($smile_row['smile_short'],"<img src='" . $smile_row['smile_path'] . "' border=0>",$text);
 }
$text = preg_replace('#\[(code|php|html)\](.*)\[/\\1\]#siUe', "strip_smiles(str_replace('\\\"', '\"', '\\0'))", $text);
$text = $SF->SmartCode_replace($text);
$Smarty->assign('text',$text);
$Smarty->display('preview.tpl');
$Smarty->display('footer.tpl');
}
?>